package com.gradecak.alfresco.mvc.servlet;

import java.util.Enumeration;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;

import org.apache.commons.lang.StringUtils;
import org.springframework.util.Assert;

public class FrameworkServletConfig implements ServletConfig {

	private static final String DEFAULT_SERVLET_NAME = "Alfresco @MVC Servlet";

	private ServletContext servletContext;
	private String servletName;

	public FrameworkServletConfig(ServletContext servletContext) {
		this(servletContext, DEFAULT_SERVLET_NAME);
	}

	public FrameworkServletConfig(ServletContext servletContext, String servletName) {
		Assert.notNull(servletContext, "servletContext must not be null");
		if (StringUtils.isEmpty(servletName)) {
			servletName = DEFAULT_SERVLET_NAME;
		}

		this.servletContext = servletContext;
		this.servletName = servletName;
	}

	public String getServletName() {
		return servletName;
	}

	public ServletContext getServletContext() {

		return servletContext;
	}

	public Enumeration getInitParameterNames() {
		return new Enumeration<String>() {

			public boolean hasMoreElements() {
				// TODO Auto-generated method stub
				return false;
			}

			public String nextElement() {
				return null;
			}

		};
	}

	public String getInitParameter(String name) {
		return null;
	}
}
